<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		*{
			margin: 0px;
			padding: 0px;
		}
		li{
			list-style:none;
		}
		.box{
			width: 450px;
			height: 340px;
			margin: 100px auto 0px;
		}
		.top{
			width: 450px;
			height: 40px;
		}
		.top .top_item{
			width: 20%;
			height: 40px;
			float: left;
			line-height: 40px;
			text-align: center;
			background: #F5F5F5 url() 0 0 no-repeat;
		}

		.buttom{
			width: 450px;
			height: 300px;
			position: relative;
		}

		.buttom .b_item{
			width: 450px;
			height: 300px;
			background: #80B600 url() 0 0 no-repeat;
			font-size: 50px;
			line-height: 300px;
			text-align: center;
			color: #fff;
			/*position: absolute;*/
			/*top: 0px;*/
			display: none;
		}



	</style>
	<script type="text/javascript"src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
	<script type="text/javascript">
		// window.onload = function  () {
		// 	var top = document.getElementsByClassName('top_item');

		// 	var b_item = document.getElementsByClassName('b_item');

		// 	for (var i = 0; i < top.length; i++) {
		// 		top[i].index = i;
		// 		top[i].onclick = function  () {
					
		// 			for (var j = 0; j < top.length; j++) {
		// 				top[j].style.background='#F5F5F5';

		// 				b_item[j].style.display='none';
		// 			};

		// 			top[this.index].style.background='#80B600';

		// 			b_item[this.index].style.display='block';
		// 		}
		// 	};
		// }
		// 
		$(function  () {
			$('.top_item').click(function(event) {

				index = $(this).index();

				$(this).css('background', '#80B600').siblings().css('background', '#F5F5F5');

				$('.b_item').eq(index).show().siblings().hide();
				
			});
		})
	</script>
</head>
<body>
	<div class="box">
		<ul class="top">
			<li class="top_item" style="background:#80B600">tab1</li>
			<li class="top_item">tab2</li>
			<li class="top_item">tab3</li>
			<li class="top_item">tab4</li>
			<li class="top_item">tab5</li>
		</ul>
		<ul class="buttom">
			<li class="b_item" style="display:block">content1</li>
			<li class="b_item">content2</li>
			<li class="b_item">content3</li>
			<li class="b_item">content4</li>
			<li class="b_item">content5</li>
		</ul>
	</div>
</body>
</html>